{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 模拟实现梯度下降法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from matplotlib import pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "plot_x = np.linspace(-1, 6, 140)   #  [-1, 6]之间分140个点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "plot_y = (plot_x - 2.5)**2 -1      # x 对应的二次函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0xd65f2bf588>]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3dd3zV5d3/8dcnOyEhIZBBSEKAhBE2ho2DIVpBUWsrbi3qbVXEu2pb29r2tre23h1qW6sPJy5QURwVRQUZCgiEPcIIIxsSRvY+uX5/EPtDZCYnuc73nM/z8eBBEuM570fEt5fX9xpijEEppZTz+NkOoJRSqmW0wJVSyqG0wJVSyqG0wJVSyqG0wJVSyqEC2vPNunTpYlJSUtrzLZVSyvHWrVt3yBgTc+LX27XAU1JSyMzMbM+3VEopxxORnJN9XadQlFLKobTAlVLKobTAlVLKobTAlVLKobTAlVLKobTAlVLKobTAlVLKoRxR4As2F/Hm6pMug1RKKY+Wf7SaJxbuoLii1u2v7YgC/2RLEX/5bCd1jS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HVXgInKViOQDo4EFIvKZ7UzHM8Y0AvcCn3HsIds7xphtdlOdmojMBVYBfUQkX0Rm2M50GmOBm4AJzUvHNjaPGD1VV2CJiGzm2H/YvzDGePzyPIeIA74WkU3AGmCBMWah5UynMxN4s/nPwhDgcXe9sG6lV0oph3LUCFwppdT/pwWulFIOpQWulFIOpQWulFIOpQWulFIOpQWulFIOpQWulFIO9f8AIZxxnue8eyoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(plot_x, plot_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def dJ(theta):\n",
    "    return 2*(theta - 2.5)              # plot_y求导"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def J(theta):\n",
    "    return (theta - 2.5)**2 -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.499891109642585\n",
      "-0.99999998814289\n"
     ]
    }
   ],
   "source": [
    "eta = 0.1                       #学习率（步长） 改变这个值，会影响衰减函数绘制点的间隔及运算此时\n",
    "epsilon = 1e-8                  #排除精度误差\n",
    "theta = 0.0\n",
    "                                #需要求得梯度（此处也是导数）最小值点\n",
    "while True:\n",
    "    gradient = dJ(theta)\n",
    "    last_theta = theta\n",
    "    theta = theta - eta*gradient #下一个theta\n",
    "    \n",
    "    if(abs(J(theta)-J(last_theta))<epsilon):\n",
    "        break\n",
    "        \n",
    "print(theta)\n",
    "print(J(theta))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0xd65fb77e08>]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deXiU1f3+8fcnCwkJWQgJgZCEBBKWsGNYBIqyKSou1aogbd1t697aWmu1xG+t1S4uXdSfooIK4oZWRVxQUAQEEvYlEAiBLEDCkpVsMzm/PxJaxAAhM8kzz8zndV25yIRh5ibG2+N5znOOGGNQSillP35WB1BKKdU6WuBKKWVTWuBKKWVTWuBKKWVTWuBKKWVTAe35ZtHR0SYpKak931IppWwvKyvrkDEm5uSvt2uBJyUlkZmZ2Z5vqZRSticie5v7uk6hKKWUTWmBK6WUTWmBK6WUTWmBK6WUTWmBK6WUTWmBK6WUTWmBK6WUTdmiwBdt2s+81c0ug1RKKY9WcPQYT3ySTXFFjdtf2xYF/vHm/fzt0x3UOpxWR1FKqbPydmYBz3+1mzpHg9tf2xYFfu2IBI4eq+fTrQetjqKUUi3mbDC8nZnPD1JjiO8c4vbXt0WBj0uJJr5zR95cu8/qKEop1WLLc0ooKqth+oiENnl9WxS4n59wbXoCK3YdZu/hKqvjKKVUi7y5Np+o0A5M7h/bJq9viwIHuDo9AT9p/IYopZSnO1RZy+fbDnLV8B50CGibqrVNgXeLCGZC3668nVVAvdP9FwOUUsqdFq4rwNFguLaNpk/ARgUOMH1kIiUVtSzNLrY6ilJKnZIxhgVr80nv2ZmUrmFt9j62KvAJfWOIDQ9igU6jKKU8WObeo+SWVLXp6BtsVuAB/n5cfU4Cy3YUs7+s2uo4SinVrAVr8ukUFMAlg7u36fvYqsABrklPoMHAW2sLrI6ilFLfU15Tz6LNRVw2NI6QDm176JntCjyxSwjjUqJ5KzMfZ4OxOo5SSn3HBxu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MNMYMAYYCU0VktMWZzuQeYLvVIc7CBGPMUBusBX8G+MQY0w8Yghu/x7YqcGPMdmPMDqtznMZIYJcxJtcYUwcsAC63ONMpGWO+Bo5YnaMljDH7jTHrmj6voPFfgh7Wpjo106iy6WFg04fHrhgQkXjgEmC21Vm8iYiEA+OBlwCMMXXGmFJ3vb6tCtwGegD5JzwuwINLxq5EJAkYBqy2NsnpNU1JbACKgc+NMZ6c92ngfqDB6iAtZIDPRCRLRG6zOsxp9AJKgFeapqdmi0iou17c4wpcRJaIyJZmPjx2JHuC5k7N9dhRlx2JSCfgXeBeY0y51XlOxxjjNMYMBeKBkSIy0OpMzRGRaUCxMSbL6ixnYawxZjiN05V3iMh4qwOdQgAwHHjOGDMMqALcdm3M445UM8ZMtjqDCwqAhBMexwNFFmXxOiISSGN5zzPGLLQ6T0sZY0pFZBmN1xs88YLxWOAyEbkYCAbCReR1Y8yPLc51SsaYoqZfi0XkPRqnLz3x2lgBUHDC/329gxsL3ONG4Da3FkgVkWQR6QBMBz6wOJNXEBGhcR5xuzHmSavznImIxIhIZNPnHYHJQLa1qZpnjPmdMSbeGJNE48/sl55c3iISKiJhxz8HLsAz/8OIMeYAkC8ifZu+NAnY5q7Xt1WBi8gPRaQAOBdYJCKfWp3pRMYYB3An8CmNF9neMsZstTbVqYnIG8AqoK+IFIjIzVZnOo2xwE+AiU1LxzY0jRg9VXdgqYhsovE/7J8bYzx+eZ5NxALfiMhGYA2wyBjzicWZTucuYF7Tz8JQ4DF3vbDeSq+UUjZlqxG4Ukqp/9ECV0opm9ICV0opm9ICV0opm9ICV0opm9ICV0opm9ICV0opm/r/H8dur7Jkaf0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "theta = 0.0                  #探究theta的变化\n",
    "theta_history = [theta]\n",
    "while True:\n",
    "    gradient = dJ(theta)\n",
    "    last_theta = theta\n",
    "    theta = theta - eta*gradient #下一个theta\n",
    "    theta_history.append(theta)\n",
    "    \n",
    "    if(abs(J(theta)-J(last_theta))<epsilon):\n",
    "        break\n",
    "plt.plot(plot_x, plot_y)              #绘制二次函数曲线\n",
    "plt.plot(np.array(theta_history), J(np.array(theta_history)), 'r+')   #绘制衰减函数点，可看起始点及间隔，开始的时候梯度陡，间隔大"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "46"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(theta_history)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "theta_history = []                              #封装\n",
    "\n",
    "def gradient_descent(initial_theta, eta, epsilon=1e-8):\n",
    "    theta = initial_theta\n",
    "    theta_history.append(initial_theta)\n",
    "\n",
    "    while True:\n",
    "        gradient = dJ(theta)\n",
    "        last_theta = theta\n",
    "        theta = theta - eta * gradient\n",
    "        theta_history.append(theta)\n",
    "    \n",
    "        if(abs(J(theta) - J(last_theta)) < epsilon):\n",
    "            break\n",
    "            \n",
    "def plot_theta_history():\n",
    "    plt.plot(plot_x, J(plot_x))\n",
    "    plt.plot(np.array(theta_history), J(np.array(theta_history)), 'r+')\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3deXTU1f3/8ec7C4Q1gIQlBAgYRJDdyGoFwV1cahfXVluXri7fLrbfX2uN3fttT6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1AnddBWsgBb5rZcjO7xeswxzAUKAUeDU1PPWRmXSL15lFX4Gb2tpmtaeIrakeyDVgT16J21OVHZtYVeAG4wzl3wOs8x+Kcq3XOjQMygIlmNsrrTE0xs9nAbufccq+znIBpzrkJBKcrv2NmZ3kdqBlJwATgfufceKACiNi9sag7Us05d47XGcJQBAxs8DoDKPEoS8wxs2SC5f2kc+5Fr/O0lHOuzMzmE7zfEI03jKcBl5rZRUAK0N3MnnDOXedxrmY550pCv+42s38RnL6MxntjRUBRg//7ep4IFnjUjcB9bhkwzMyGmFkH4CrgZY8zxQQzM4LziOudc3/0Os/xmFmamfUIfd8JOAfY4G2qpjnn/tc5l+GcyyT4d/bdaC5vM+tiZt3qvwfOIzr/w4hzbidQaGbDQ5dmAesi9f6+KnAz+7yZFQFTgFfN7A2vMzXknAsA3wXeIHiT7Vnn3FpvUzXPzJ4GFgPDzazIzG70OtMxTAO+AswMLR1bGRoxRqv+wDwz+5jgf9jfcs5F/fI8n+gLfGBmq4ClwKvOudc9znQstwJPhv4ujAN+Hak31lZ6ERGf8tUIXEREjlKBi4j4lApcRMSnVOAiIj6lAhcR8SkVuIiIT6nARUR86v8DzSxfSKn58sMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "eta = 0.01                #调用\n",
    "theta_history = []\n",
    "gradient_descent(0, eta)\n",
    "plot_theta_history()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "424"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(theta_history)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCS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LjANmmNlkjzO15iFgi9chzsFU59w4H6wFfwx41zk3DBhLEH/Gvipw59wW59w2r3O0YCKw0zm32zlXA8wFbvQ4U7Occx8Dh73O0RbOub3OudVNH1fQ+EvQz9tUzXONjjd9Gt/0J2xXDJhZJnAt8KTXWSKJmSUDlwCzAS6rhxkAAAITSURBVJxzNc658mC9vq8K3Af6AUWnfV5MGJeMX5lZNjAeWO5tkpY1TUmsBQ4AHzjnwjnvo8AjQIPXQdrIAe+b2Sozu9frMC0YBJQBTzdNTz1pZonBevGwK3Azm29mG8/yJ2xHsqc5255dYTvq8iMz6wa8DjzsnDvmdZ6WOOfqnXPjgExgopmN8jrT2ZjZdcAB59wqr7OcgynOuQk0Tlfeb2aXeB2oGXHABOBx59x4oBII2rmxsNtSzTk33esMASgG+p/2eSZQ6lGWiGNm8TSW9wvOuXle52kr51y5mS2k8XxDOJ4wngLcYGbXAAlAspk975z7mse5muWcK236+4CZvUHj9GU4nhsrBopP+7+v1whigYfdCNznVgKDzWygmXUCZgJvepwpIpiZ0TiPuMU59xuv87TGzNLMLLXp4y7AdGCrt6nOzjn3I+dcpnMum8b37EfhXN5mlmhmSac+Bq4kPP9hxDm3Dygys6FNX5oGbA7W6/uqwM3si2ZWDFwIvGVm73md6XTOuTrgAeA9Gk+yveKc2+RtquaZ2UvAMmComRWb2Te9ztSCKcDtwOVNS8fWNo0Yw1VfYIGZrafxH/YPnHNhvzzPJ3oDn5jZOmAF8JZz7l2PM7XkO8ALTe+FccAvgvXCupReRMSnfDUCFxGR/6MCFxHxKRW4iIhPqcBFRHxKBS4i4lMqcBERn1KBi4j41P8HmJ7Bd+mhzBcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "eta = 0.0001\n",
    "theta_history = []\n",
    "gradient_descent(0, eta)\n",
    "plot_theta_history()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "31072"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(theta_history)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAgAElEQVR4nO3dd3jV5f3/8ec7m4QMAiGMJCSQMMLGCAgoshQRRx0V1Lq1bq22tbZasbVaW+us4tcFqCAoolURURAUAYGwVyABAhmQhJFByM79+yOxP4rM5CT3+ZzzflxXLpKTcM6rMX3l5v7cn/sWYwxKKaWcx8d2AKWUUg2jBa6UUg6lBa6UUg6lBa6UUg6lBa6UUg7l15wv1qZNGxMfH9+cL6mUUo63evXq/caYqGMfb9YCj4+PJzU1tTlfUimlHE9Edh/vcZ1CUUoph9ICV0oph9ICV0oph9ICV0oph9ICV0oph9ICV0oph9ICV0oph3JEgc/dsJfpK467DFIppdxa9qEjPPtVGvkl5S5/bkcU+Jcb9/Lc/G1UVNfYjqKUUmfko9RsXv9uB5XVtS5/bkcU+DVnx3LoSBXzN+fZjqKUUqetptbwUWoW5yZFEdMq2OXP74gCH5bYhphWLZi1ao/tKEopddqWpBeQW1TOhLNjm+T5HVHgPj7CNSmxLM04wO4DpbbjKKXUaZm1KovIkABG94hukud3RIEDXJ0Si4/UfUOUUsrd7T9cwTdb8rhyQEcC/Jqmah1T4O3CgxjRrS0frc6mqsb1FwOUUsqV5qzJprrWcE0TTZ+AgwocYMLAOApKKliUlm87ilJKnZAxhpmrskjp1IrEtqFN9jqOKvAR3aKIDgtkpk6jKKXcWOruQ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eVQ/w9y2X8DGjNArwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "eta = 0.8\n",
    "theta_history = []\n",
    "gradient_descent(0, eta)\n",
    "plot_theta_history()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "ename": "OverflowError",
     "evalue": "(34, 'Result too large')",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mOverflowError\u001b[0m                             Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-16-89c87a003181>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[0meta\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1.1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[0mtheta_history\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mgradient_descent\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0meta\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32m<ipython-input-10-52e2a83afa81>\u001b[0m in \u001b[0;36mgradient_descent\u001b[1;34m(initial_theta, eta, epsilon)\u001b[0m\n\u001b[0;32m     11\u001b[0m         \u001b[0mtheta_history\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     12\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 13\u001b[1;33m         \u001b[1;32mif\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mabs\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mJ\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mJ\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlast_theta\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m<\u001b[0m \u001b[0mepsilon\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     14\u001b[0m             \u001b[1;32mbreak\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     15\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m<ipython-input-6-01823742d728>\u001b[0m in \u001b[0;36mJ\u001b[1;34m(theta)\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mJ\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m     \u001b[1;32mreturn\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mtheta\u001b[0m \u001b[1;33m-\u001b[0m \u001b[1;36m2.5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m**\u001b[0m\u001b[1;36m2\u001b[0m \u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mOverflowError\u001b[0m: (34, 'Result too large')"
     ]
    }
   ],
   "source": [
    "eta = 1.1\n",
    "theta_history = []\n",
    "gradient_descent(0, eta)  #这里报错是因为eta太大，导致梯度不降反增，往开口处走了，超出了最大的阈值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "def J(theta):\n",
    "    try:\n",
    "        return (theta-2.5)**2 - 1.\n",
    "    except:\n",
    "        return float('inf')              #容错机制"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-18-89c87a003181>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[0meta\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1.1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[0mtheta_history\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mgradient_descent\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0meta\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32m<ipython-input-10-52e2a83afa81>\u001b[0m in \u001b[0;36mgradient_descent\u001b[1;34m(initial_theta, eta, epsilon)\u001b[0m\n\u001b[0;32m      9\u001b[0m         \u001b[0mlast_theta\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtheta\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     10\u001b[0m         \u001b[0mtheta\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtheta\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0meta\u001b[0m \u001b[1;33m*\u001b[0m \u001b[0mgradient\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 11\u001b[1;33m         \u001b[0mtheta_history\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     12\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     13\u001b[0m         \u001b[1;32mif\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mabs\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mJ\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtheta\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mJ\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlast_theta\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m<\u001b[0m \u001b[0mepsilon\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "eta = 1.1\n",
    "theta_history = []\n",
    "gradient_descent(0, eta)        #这里陷入死循环，强制中断，在while循环里if判断的是一个not a number数值，所以死循环，无法break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "def gradient_descent(initial_theta, eta, n_iters = 1e4, epsilon=1e-8):        #增加最多循环次数10000，以防止无止境循环\n",
    "    \n",
    "    theta = initial_theta\n",
    "    i_iter = 0\n",
    "    theta_history.append(initial_theta)\n",
    "\n",
    "    while i_iter < n_iters:\n",
    "        gradient = dJ(theta)\n",
    "        last_theta = theta\n",
    "        theta = theta - eta * gradient\n",
    "        theta_history.append(theta)\n",
    "    \n",
    "        if(abs(J(theta) - J(last_theta)) < epsilon):\n",
    "            break\n",
    "            \n",
    "        i_iter += 1\n",
    "        \n",
    "    return"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "eta = 1.1\n",
    "theta_history = []\n",
    "gradient_descent(0, eta)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10001"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(theta_history)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "nan"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "theta_history[-1]         # not a number"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAAS9UlEQVR4nO3dfYxddZ3H8fe3zwj0ge30gT7IU1FQ5GkW2cC6iCgIJ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/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "eta = 1.1\n",
    "theta_history = []\n",
    "gradient_descent(0, eta, n_iters=10)\n",
    "plot_theta_history()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
